package fission;

/**
 *
 * @author MichaelAlbert
 */
public class FissionMain {

    public static void main(String[] args) throws InterruptedException {
        boolean[][] board = new boolean[11][11];
        board[5][5] = Fission.STONE;
        //board[2][3] = Fission.STONE;
        FissionGame g = new FissionGame(board);
        System.out.println(g);
        FissionPlayer a = new BetterPlayer("BetterPlayer", Fission.VERTICAL);
        FissionPlayer b = new BetterPlayer("EquallyBetterPlayer", Fission.HORIZONTAL);
        FissionPlayer currentPlayer = a;
        while(true){
        	Thread t = new Thread(new FissionMoveGenerator(g, currentPlayer));
        	t.start();
        	t.join(6000);
        	t.interrupt();
        	if(!g.isValidMove(currentPlayer.getMove())){
        		break;
        	}
        	g.doMove(currentPlayer.getMove());
        	System.out.println(currentPlayer.getMove());
        	System.out.println(g);
        	//System.out.println(currentPlayer.makeComment());
        	currentPlayer = (currentPlayer == a) ? b : a;
        }
        System.out.println("The winner is: " + ((currentPlayer == a) ? b : a));
        }
    }
